package org.tempuri;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.bouncycastle.asn1.cmp.InfoTypeAndValue;
import org.tempuri.CoordinateServiceStub.InData_type0;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

public class InJsonData {
	Map<String, List<JSONObject>> inDataSet = new HashMap<String, List<JSONObject>>();
	
	public static String getRequsetJsonData(String handleType, String handleCode, String userCode, String platCod,
			String dataBaseName, String clientIP, String functionID){
		InJsonData inJsonData= new InJsonData();
		List<JSONObject> sysDataTableItem = new ArrayList<JSONObject>();
		SysDataTableItem item = new SysDataTableItem(handleType, handleCode, userCode, platCod, dataBaseName, clientIP, functionID);
		sysDataTableItem.add(JSONObject.parseObject(JSON.toJSONString(item)));
		inJsonData.getInDataSet().put("SysDataTable", sysDataTableItem);
		return inJsonData.toJsonString();
	}

	public static String getRequsetJsonData(String handleType, String handleCode, String userCode, String platCod,
			String dataBaseName, String clientIP, String functionID, Map<String, List<JSONObject>> otherTables){
		InJsonData inJsonData= new InJsonData();
		List<JSONObject> sysDataTableItem = new ArrayList<JSONObject>();
		SysDataTableItem item = new SysDataTableItem(handleType, handleCode, userCode, platCod, dataBaseName, clientIP, functionID);
		sysDataTableItem.add(JSONObject.parseObject(JSON.toJSONString(item)));
		inJsonData.getInDataSet().put("SysDataTable", sysDataTableItem);
		inJsonData.getInDataSet().putAll(otherTables);
		return inJsonData.toJsonString();
		
	}
	
	private static class SysDataTableItem{
		private String HandleType;
		private String HandleCode;
		private String UserCode;
		private String PlatCode;
		private String DataBaseName;
		private String ClientIP;
		private String FunctionID;
		public SysDataTableItem(String handleType, String handleCode, String userCode,
				String platCode, String dataBaseName, String clientIP,
				String functionID) {
			super();
			HandleType = handleType;
			HandleCode = handleCode;
			UserCode = userCode;
			PlatCode = platCode;
			DataBaseName = dataBaseName;
			ClientIP = clientIP;
			FunctionID = functionID;
		}
		public String getHandleType() {
			return HandleType;
		}
		public void setHandleType(String handleType) {
			HandleType = handleType;
		}
		public String getHandleCode() {
			return HandleCode;
		}
		public void setHandleCode(String handleCode) {
			HandleCode = handleCode;
		}
		public String getUserCode() {
			return UserCode;
		}
		public void setUserCode(String userCode) {
			UserCode = userCode;
		}
		public String getPlatCode() {
			return PlatCode;
		}
		public void setPlatCode(String platCode) {
			PlatCode = platCode;
		}
		public String getDataBaseName() {
			return DataBaseName;
		}
		public void setDataBaseName(String dataBaseName) {
			DataBaseName = dataBaseName;
		}
		public String getClientIP() {
			return ClientIP;
		}
		public void setClientIP(String clientIP) {
			ClientIP = clientIP;
		}
		public String getFunctionID() {
			return FunctionID;
		}
		public void setFunctionID(String functionID) {
			FunctionID = functionID;
		}
		
	}

	public String toJsonString(){
		return JSON.toJSONString(inDataSet);
	}

	public Map<String, List<JSONObject>> getInDataSet() {
		return inDataSet;
	}

	public void setInDataSet(Map<String, List<JSONObject>> inDataSet) {
		this.inDataSet = inDataSet;
	}
	
}
